package dfbz.homework1;

public class Test17 {
    /*
    * 5道单项选择题，标准答案为 ：【ADBCD】
   四名同学答案分别为：
   小明：【DCBAD】
   小红：【ADBCD】
  小黄：【ADBCA】
   小强：【ABCDD】
     给这4名同学评分,答对一道题给2分
    * */
    public static void main(String[] args) {
        String[] answer={"A","D","B","C","D"};//答案
        String[] Teacher1={"D","C","B","A","D"};//同学
        String[] Teacher2={"A","D","B","C","D"};
        String[] Teacher3={"A","D","B","C","A"};
        String[] Teacher4={"A","B","C","D","D"};
        int stuentScore1= checkAnswer(answer, Teacher1);
        int stuentScore2= checkAnswer(answer, Teacher2);
        int stuentScore3= checkAnswer(answer, Teacher3);
        int stuentScore4= checkAnswer(answer, Teacher4);
        System.out.println("同学1的分数为："+stuentScore1);
        System.out.println("同学2的分数为："+stuentScore2);
        System.out.println("同学3的分数为："+stuentScore3);
        System.out.println("同学4的分数为："+stuentScore4);

    }
    public static int checkAnswer(String[] arr, String[] Teacher1){
        int count1=0;
        for (int i = 0; i <arr.length ; i++) {
            if(arr[i]==Teacher1[i]){
                count1+=2;
            }
        }
        return count1;
    }
}
